<script src="<?=base_url();?>lib/color/js/colpick.js" type="text/javascript"></script>
<link rel="stylesheet" href="<?=base_url();?>lib/color/css/colpick.css" type="text/css"/>
<form class="layui-form layui-form-pane" action="" method="post" style="margin:30px;">
    <div class="layui-form-item">
      <label class="layui-form-label">ID</label>
      <div class="layui-input-inline">
        <input type="" name="id"  class="layui-input" disabled="true">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">门店名称</label>
      <div class="layui-input-inline">
        <input type="" name="store_name"  placeholder="请输入轮排方式" class="layui-input" lay-verify="required">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">门店负责人</label>
      <div class="layui-input-inline">
        <input type="" name="store_manager"  placeholder="请输入轮排方式" class="layui-input" lay-verify="">
      </div>
    </div>
    
    <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
          
        </div>
      </div>
</form>
<script type="text/javascript">
  //颜色选择器
  $("input[name='color']").colpick({
     submit: false,
        onChange: function (color, color2) {
            $("input[name='color']").val('#'+color2);
        }
  });
    
	// 定位打开页面光标位置
	$(document).ready(function(){
		$("input[name='name']").focus();
	});
	//var index = layer.open();
 
	layui.use('form', function(){
    var form = layui.form;

    form.on('submit(formDemo)', function(data,index){
    	
      $.post('suggest_store_add',data.field,function(data){
      	
        console.log(data.status);
        if(data.status){
          layer.msg(data.msg);
          //刷新父级窗口
          
          var index =parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
          setTimeout(function(){
            window.parent.location.reload();
            parent.layer.close(index); //再执行关闭 
          },2000);
          
        }else{
          layer.msg(data.msg);
        }
        
      },'json');
      return false;
    });


  });
</script>